package com.mr.sell.service;

import com.mr.sell.dao.ProductCategoryDao;
import com.mr.sell.entity.ProductCategory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryService {

    @Autowired
    private ProductCategoryDao dao;

    public ProductCategory getOne(int id){
        ProductCategory productCategory = dao.findById(id).orElse(null);
        return productCategory;
    }
    public List<ProductCategory> getAll(){
        return dao.findAll();
    }
    public List<ProductCategory> findByCategoryTypeIn(List<Integer> list){
        return dao.findByCategoryTypeIn(list);
    }
    public void save(ProductCategory category){
        dao.save(category);
    }

}
